-
Notifications
You must be signed in to change notification settings - Fork 208
[ENH] basic setar-tree module and tests #2890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you for contributing to
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, more to come.
Parameters | ||
---------- | ||
lag : int, default=10 | ||
The maximum number of past lags to consider for both the AR models | ||
and as the thresholding variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should document the horizon here also, you can reuse the text from other classes..
lag : int, default=10 | ||
The maximum number of past lags to consider for both the AR models | ||
and as the thresholding variable. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an example usage of the class to the docstring here.
|
||
for _lag in range(self.lag, 0, -1): | ||
if len(y) <= _lag: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just lag
should be fine for this loop, no _ needed as its not an attribute.
|
||
class SetarForecaster(BaseForecaster): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test file for this class and add some functions. If you could generate some expected results from another implementation to ensure correctness that would be good as well.
|
||
class SetarForecaster(BaseForecaster): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the class name should just be SETAR
. I do not think this is used anywhere other than forecasting, and we can easily change if it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the regular SETAR to the init as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good start. Could you post here on what your current plans are for testing correctness i.e. data used and results/implementation to compare against.
You mentioned previously having some issues with implementing global methods using the current framework. Could you also post that here?
Please add the classes to the API documentation in docs/
|
||
class SetartreeForecaster(BaseForecaster): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think SETARTree
is Bette as a name. Same reason as SETAR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will also modify SetarforestForecaster to SETARForest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering where we can improve efficiency using numba
. Do you know where most time is spent processing in the current implementation?
Current plan for testing:
Issues implementing global methods using the current framework: As for the efficiency: |
def __init__( | ||
self, | ||
lag: int = 10, | ||
horizon: int = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, set horizon tag to false and dont p[ass the horizon
|
||
return self | ||
|
||
def _predict(self, y=None, exog=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont need to check is fitted here, its done in the base class
|
||
predictions = [] | ||
|
||
for _ in range(self.horizon): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont heed a horizon here. predict should simply predict one ahead based on y. Further prediction horizon predictions are made with the iterative_forecast()
Progress: I’ve successfully reproduced the results from the paper (with a tiny gap) on the Chaotic dataset, using an independent Python implementation. I’ll update the Aeon branch once I’ve confirmed that the method works within the Aeon framework. Together be done alongside the modification requests mentioned above. |
Reference Issues/PRs
#2816.
What does this implement/fix? Explain your changes.
In this commit, the major functions for the setar-tree algorithm is implemented, and the basic test file to test them.
Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
This is the initial commit for #2816.
Next steps:
PR checklist
For all contributions
For new estimators and functions
__maintainer__
at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access